﻿using System.Data.Entity.ModelConfiguration;

namespace InvestmentIntelligence.DbModel.Models.Mapping
{
    internal class InvestmentBenchmarkUnderlyingSerieMap : EntityTypeConfiguration<InvestmentBenchmarkUnderlyingSerie>
    {
        public InvestmentBenchmarkUnderlyingSerieMap()
        {
            // Primary Key
            this.HasKey(t => new { t.InvestmentId, t.UnderlyingSecurityId, t.BenchmarkId, t.Date });

            // Table & Column Mappings
            this.ToTable("InvestmentBenchmarkUnderlyingSerie", "Analytics");
            this.Property(t => t.InvestmentId).HasColumnName("InvestmentId");
            this.Property(t => t.UnderlyingSecurityId).HasColumnName("UnderlyingSecurityId");
            this.Property(t => t.BenchmarkId).HasColumnName("BenchmarkId");
            this.Property(t => t.Date).HasColumnName("Date");
            this.Property(t => t.StockReturn).HasColumnName("StockReturn").HasPrecision(29, 20);
        }
    }
}
